<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="utf-8">
		<title>
			X-admin v1.0
		</title>
		<!-- Required meta tags -->
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="./css/x-admin.css" media="all">
		<link rel="stylesheet" href="css/style.css">
		<link href="css/xtiper.css" type="text/css" rel="stylesheet" />
		<script src="js/xtiper.min.js" type="text/javascript"></script>

	</head>

	<body onload="getnumber()">
		<div class="row">
			<div class="col-lg-12 grid-margin">
				<div class="card performance-cards">
					<div class="card-body">
						<h4 class="card-title mb-0">公告</h4>

						<div class="d-flex justify-content-between align-items-center">
							<div class="d-inline-block pt-3">
								<div class="d-flex">
									<h1 class="mb-0" id="adverContent" name="adverContent" style="font-size: 20px;"></h1>
								</div>
							</div>
							<div class="xbutton">
								<button type="submit" class="btn btn-success mr-2" onclick="changeAdver()">编辑</button>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-lg-12 grid-margin">
				<div class="card performance-cards">
					<div class="card-body">
						<div class="row">
							<div class="col d-flex flex-row justify-content-center align-items-center" onclick="unsure()">
								<div class="wrapper icon-circle bg-danger">
									<i class="icon-briefcase icons"></i>
								</div>
								<div class="wrapper text-wrapper">
									<p class="text-dark" id="unsure" name="unsure"></p>
									<p style="color: #C12E2A;">未确认订单</p>
								</div>
							</div>

							<div class="col d-flex flex-row justify-content-center align-items-center" onclick="untake()">
								<div class="wrapper icon-circle bg-warning">
									<i class="icon-umbrella icons"></i>
								</div>
								<div class="wrapper text-wrapper">
									<p class="text-dark" id="sure" name="sure"></p>
									<p>已确认订单</p>
								</div>
							</div>
							<div class="col d-flex flex-row justify-content-center align-items-center" onclick="cancel()">
								<div class="wrapper icon-circle bg-primary">
									<i class="icon-check icons"></i>
								</div>
								<div class="wrapper text-wrapper">
									<p class="text-dark" id="cancel" name="cancel"></p>
									<p style="color: #AC2925;">申请取消订单</p>
								</div>
							</div>
							<div class="col d-flex flex-row justify-content-center align-items-center" onclick="finish()">
								<div class="wrapper icon-circle bg-success">
									<i class="icon-rocket icons"></i>
								</div>
								<div class="wrapper text-wrapper">
									<p class="text-dark" id="finish" name="finish"></p>
									<p>已完成订单</p>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- ROW ENDS -->
		<div class="row">
			<div class="col-md-4 grid-margin stretch-card">
				<div class="card">
					<div class="card-body">
						<h4 class="card-title mb-0">未取订单</h4>
						<div class="d-flex justify-content-between align-items-center">
							<div class="d-inline-block pt-3">
								<div class="d-flex">
									<h1 class="mb-0" id="untake" name="untake" style="font-size: 35px;"></h1>
								</div>
							</div>
							<button type="submit" class="btn btn-success mr-2" onclick="untake()">查看</button>
						</div>
					</div>
				</div>
			</div>
			<div class="col-md-4 grid-margin stretch-card">
				<div class="card">
					<div class="card-body">
						<h4 class="card-title mb-0">代送订单</h4>
						<div class="d-flex justify-content-between align-items-center">
							<div class="d-inline-block pt-3">
								<div class="d-flex">
									<h1 class="mb-0" id="unexpress" name="unexpress" style="font-size: 35px;"></h1>
								</div>
							</div>
							<button type="submit" class="btn btn-success mr-2" onclick="express()">配送</button>
						</div>
					</div>
				</div>
			</div>
			<div class="col-md-4 grid-margin stretch-card">
				<div class="card">
					<div class="card-body">
						<h4 class="card-title mb-0">已评论未回复订单</h4>
						<div class="d-flex justify-content-between align-items-center">
							<div class="d-inline-block pt-3">
								<div class="d-flex">
									<h1 class="mb-0" id="unfeedback" name="unfeedback" style="font-size: 35px;"></h1>
								</div>
							</div>
							<button type="submit" class="btn btn-success mr-2" onclick="unfeedback()">查看</button>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="row section social-section">
			<div class="col-lg-4 grid-margin stretch-card">
				<div class="social-card w-100 bg-facebook">
					<div class="social-icon">
						<i class="icon-social-facebook icons"></i>
					</div>
					<div class="content">
						<p id="newusers"></p>
						<p>昨日新用户数</p>
					</div>
				</div>
			</div>
			<div class="col-lg-4 grid-margin stretch-card">
				<div class="social-card w-100 bg-twitter">
					<div class="social-icon">
						<i class="icon-social-twitter icons">
                  </i>
					</div>
					<div class="content">
						<p id="newmoney"></p>
						<p>昨日平台营业额</p>
					</div>
				</div>
			</div>
			<div class="col-lg-4 grid-margin stretch-card">
				<div class="social-card w-100 bg-dribbble">
					<div class="social-icon">
						<i class="icon-social-dribbble icons"></i>
					</div>
					<div class="content">
						<p id="neworders"></p>
						<p>昨日共完成订单</p>
					</div>
				</div>
			</div>
			<script type="text/javascript">
				function untake() {
					location.href = "./order-list-sure.html";
				}
			</script>
			<script type="text/javascript">
				function express() {
					location.href = "./order-list-sure.html";
				}
			</script>
			<script type="text/javascript">
				function cancel() {
					location.href = "./order-list-applycancel.html";
				}
			</script>
			<script type="text/javascript">
				function unsure() {
					location.href = "./order-list-unsure.html";
				}
			</script>
			<script type="text/javascript">
				function finish() {
					location.href = "./order-list-finish.html";
				}

				function unfeedback() {
					location.href = "./comment-list.html";
				}
			</script>
			<script src="js/jquery.min.js"></script>
			<script type="text/javascript">
				function getnumber() {
					var url = 'http://127.0.0.1:8080/order/getnumber';
					$.ajax({
						type: "get", //post方式传输，比get更加密安全
						url: url, //请求地址
						contentType: "application/json;charsetset=UTF-8",
						success: function(data) {
							$("#unsure").text(data[0]);
							$("#sure").text(data[1]);
							$("#cancel").text(data[2]);
							$("#finish").text(data[3]);
							$("#untake").text(data[1]);
							$("#unexpress").text(data[5]);
							$("#unfeedback").text(data[4]);
							$("#newusers").text(data[8]);
							$("#newmoney").text(data[7]);
							$("#neworders").text(data[6]);

						},
						error: function() {
							alert("获取数据失败");
						}
					})
					var url2 = 'http://127.0.0.1:8080/order/findAdvert';
					$.ajax({
						type: "get", //post方式传输，比get更加密安全
						url: url2, //请求地址
						contentType: "application/json;charsetset=UTF-8",
						success: function(data) {
							$("#adverContent").text(data.adverContent);
						},
						error: function() {
							alert("获取数据失败");
						}
					})
				}
			</script>
			<script>
				function changeAdver(){
					xtip.win({
					tip: '<textarea  id="advertisemant" name="advertisemant" cols="25" rows="5" placeholder="请输入广告内容" style="border: 1px solid #E6E6E6;"></textarea>',
					icon: 'w',
					title: '广告编辑',
					btn: ['确认', '取消'],
					btn1: function() {
						var ins = $("#advertisemant").val();
						var url2 = 'http://127.0.0.1:8080/order/updateAdvertisement?advertisemant='+ins;
						var settings = {
							"url": url2,
							"method": "POST",
							"timeout": 0,
							"headers": {
								"Content-Type": "application/json"
							},
							"data": JSON.stringify({
								"advertisemant": ins
							}),
						};

						$.ajax(settings).done(function(response) {
							xtip.msg("编辑成功", {
								times: 1
							});
							location.href = "./welcome.html";
						});
					}
				})
				}
			</script>
	</body>

</html>